﻿using System;
using Newtonsoft.Json.Linq;
using JsonCSharpClassGenerator;

namespace Search
{

    internal class Movie
    {

        private JObject __jobject;
        public Movie(JObject obj)
        {
            this.__jobject = obj;
        }

        public int Code
        {
            get
            {
                return JsonClassHelperSearch.ReadInteger(JsonClassHelperSearch.GetJToken<JValue>(__jobject, "code"));
            }
        }

        public string OriginalTitle
        {
            get
            {
                return JsonClassHelperSearch.ReadString(JsonClassHelperSearch.GetJToken<JValue>(__jobject, "originalTitle"));
            }
        }

        public int ProductionYear
        {
            get
            {
                return JsonClassHelperSearch.ReadInteger(JsonClassHelperSearch.GetJToken<JValue>(__jobject, "productionYear"));
            }
        }

        [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
        private Poster _poster;
        public Poster Poster
        {
            get
            {
                if(_poster == null)
                    _poster = JsonClassHelperSearch.ReadStronglyTypedObject<Poster>(JsonClassHelperSearch.GetJToken<JObject>(__jobject, "poster"));
                return _poster;
            }
        }

    }
}
